import { request } from '@umijs/max';

/** 分页查询设备型号 GET /terminal/model/list */
export async function getTerminalModelListByPage(params: API.QueryTerminalModelPageParams) {
  return request<API.QueryPageResp<API.TerminalModel>>('/terminal/model/list', {
    method: 'GET',
    params,
  });
}

/** 新增设备型号 POST /terminal/model/add */
export async function addTerminalModel(params: API.TerminalModel) {
  return request<API.Resp>('/terminal/model/add', {
    method: 'POST',
    data: params,
  });
}

/** 更新设备型号 POST /terminal/model/update */
export async function updateTerminalModel(params: API.TerminalModel) {
  return request<API.Resp>('/terminal/model/update', {
    method: 'POST',
    data: params,
  });
}

/** 通过ID查询单条设备型号 GET /terminal/model/get/{id} */
export async function getTerminalModelById(id: React.Key) {
  return request<API.Resp<API.TerminalModel>>(`/terminal/model/get/${id}`, {
    method: 'GET',
  });
}

/** 通过ID删除单条设备型号 POST /terminal/model/delete */
export async function deleteTerminalModelById(id: React.Key) {
  return request<API.Resp>(`/terminal/model/delete`, {
    method: 'POST',
    params: {
      id,
    },
  });
}

/** 查询设备类型下拉框列表 GET /terminal/model/select */
export async function getTerminalModelSelect() {
  return request<API.Resp<API.TerminalModelSelect[]>>(`/terminal/model/select`, {
    method: 'GET',
  });
}
